Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: capability to send the client response to clipboard #130

Merged
merged 2 commits into from
Sep 30, 2023

Conversation

juantarrel
Copy link
Contributor

Incredible tool, thank you for creating it, it has been very useful for me. I Created this simple pr to add the ability to save the client's response to the clipboard, it's not a big change, but it's something useful for me.

@tbckr
Copy link
Owner

tbckr commented Sep 29, 2023

Thanks for your contribution! I will have a look into it!

Copy link
Owner

@tbckr tbckr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your solution! Maybe we could change the test a little bit.

cli/root_test.go Outdated
defer wg.Done()
var buf bytes.Buffer
_, err := io.Copy(&buf, reader)
_ = clipboard.WriteAll(buf.String())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are overriding the values which were set in the root command. Therefore we are not actually testing the functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry you are right

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

cli/root_test.go Outdated
root.Execute([]string{"--clipboard", prompt})
require.Equal(t, 0, mem.code)
require.NoError(t, writer.Close())

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could do something like this:

Suggested change
textInClipboard := clipboard.ReadAll()
require.Equals(t, expected, textInClipboard)

With this we could remove the go func part, io.Pipe and writer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@tbckr tbckr added this to the v2.0.0 milestone Sep 30, 2023
@tbckr
Copy link
Owner

tbckr commented Sep 30, 2023

The error in the CI pipeline is expected. The Github runner does not have a clipping tool installed. I will fix this test error after the merge.
Thanks for your contribution!

@tbckr tbckr merged commit c8d1c22 into tbckr:main Sep 30, 2023
6 of 7 checks passed
tbckr pushed a commit that referenced this pull request Sep 30, 2023
* feat: capability to send the client response to clipboard

* feat: capability to send the client response to clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants